<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
    <%@ page import="java.io.*,java.util.*" %>

        <!DOCTYPE html>
        <html lang="en">

        <head>
            <meta charset="UTF-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Collect Information</title>
            <link rel="stylesheet" href="css/all.css">
        </head>

        <body>
            <!--    <form action="jsp/judge.jsp" method="get">-->
            <form action="index.jsp" method="get">
                <table class="mainTable">
                    <tr>
                        <td>
                            <span class="title"> 信息收集表 </span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" size="20" name="inputInfo" id="inputInfo">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="submit" value="判断">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="reset" value="重置">
                        </td>
                    </tr>
                </table>
            </form>
            <%
    String inputInfo = request.getParameter("inputInfo");
    if (inputInfo == null){
        //用于抵消最初开始inputInfo为Null的情况
    }else if(inputInfo != null && inputInfo.length() == 5) {
        %>
            <script>
                alert("格式判断正确！");
            </script>
            <%
    }else if(inputInfo.equals("")){
            %>
            <script>
                alert("格式错误！输入不能为空");
                document.getElementById("inputInfo").focus();
            </script>
            <%
    }else{
            %>
            <script>
                alert("格式错误！字符长度不为5");
                document.getElementById("inputInfo").focus();
            </script>
            <%
    }
    %>
        </body>

        </html>